Java Code Examples for com.paritytrading.nassau.soupbintcp.SoupBinTCP#LoginRequest

The following examples show how to use com.paritytrading.nassau.soupbintcp.SoupBinTCP#LoginRequest . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Server.java    From nassau with Apache License 2.0 6 votes vote down vote up
private Session(SocketChannel channel) {
    transport = new SoupBinTCPServer(channel, this, new SoupBinTCPServerStatusListener() {

        @Override
        public void loginRequest(SoupBinTCPServer session, SoupBinTCP.LoginRequest message) {
        }

        @Override
        public void logoutRequest(SoupBinTCPServer session) {
        }

        @Override
        public void heartbeatTimeout(SoupBinTCPServer session) {
        }

    });
}
 
Example 2
Source File: TerminalClient.java    From parity with Apache License 2.0 6 votes vote down vote up
static TerminalClient open(InetSocketAddress address, String username,
        String password, Instruments instruments) throws IOException {
    Events events = new Events();

    OrderEntry orderEntry = OrderEntry.open(address, events);

    SoupBinTCP.LoginRequest loginRequest = new SoupBinTCP.LoginRequest();

    ASCII.putLeft(loginRequest.username, username);
    ASCII.putLeft(loginRequest.password, password);
    ASCII.putRight(loginRequest.requestedSession, "");
    ASCII.putLongRight(loginRequest.requestedSequenceNumber, 0);

    orderEntry.getTransport().login(loginRequest);

    return new TerminalClient(events, orderEntry, instruments);
}
 
Example 3
Source File: Session.java    From parity with Apache License 2.0 6 votes vote down vote up
@Override
public void loginRequest(SoupBinTCPServer session, SoupBinTCP.LoginRequest payload) {
    if (username != 0) {
        close();
        return;
    }

    loginAccepted.session        = payload.requestedSession;
    loginAccepted.sequenceNumber = payload.requestedSequenceNumber;

    try {
        transport.accept(loginAccepted);
    } catch (IOException e) {
        close();
    }

    username = ByteArrays.packLong(payload.username, SPACE);
}
 
Example 4
Source File: OrderEntry.java    From parity-extras with Apache License 2.0 5 votes vote down vote up
public void login(String username, String password) throws IOException {
    SoupBinTCP.LoginRequest request = new SoupBinTCP.LoginRequest();

    ASCII.putLeft(request.username, username);
    ASCII.putLeft(request.password, password);
    ASCII.putRight(request.requestedSession, "");
    ASCII.putLongRight(request.requestedSequenceNumber, 0);

    transport.login(request);
}
 
Example 5
Source File: Session.java    From nassau with Apache License 2.0 5 votes vote down vote up
@Override
public void loginRequest(SoupBinTCPServer session, SoupBinTCP.LoginRequest payload) throws IOException {
    loginAccepted.setSession(payload.requestedSession);
    loginAccepted.setSequenceNumber(1);

    downstream.accept(loginAccepted);
}