SessionImpl session = (SessionImpl) endpoint;
TransportSession transportSession = getTransportState(session);
if(session.getLocalState() != EndpointState.UNINITIALIZED && !transportSession.beginSent())
{
int channelId = allocateLocalChannel(transportSession);
Begin begin = new Begin();
if(session.getRemoteState() != EndpointState.UNINITIALIZED)
{
begin.setRemoteChannel(UnsignedShort.valueOf((short) transportSession.getRemoteChannel()));
}
begin.setHandleMax(transportSession.getHandleMax());
begin.setIncomingWindow(transportSession.getIncomingWindowSize());
begin.setOutgoingWindow(transportSession.getOutgoingWindowSize());
begin.setNextOutgoingId(transportSession.getNextOutgoingId());
written += writeFrame(buffer, channelId, begin, null, null);
transportSession.sentBegin();
if(session.getLocalState() == EndpointState.ACTIVE)
{